home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PRINTER / RUBPB22A.ARJ / RUP22C.EXE / PSCRIPT.H < prev    next >
Text File  |  1990-12-16  |  2KB  |  129 lines

  1. /hollow-thick 4 def
  2. /stroke-thick 1 def
  3. /fin-1
  4. {
  5. eofill
  6. } bind def
  7. /fin-2
  8. {
  9. gsave
  10. eofill
  11. grestore
  12. stroke-thick setlinewidth
  13. stroke
  14. } bind def
  15. /fin-3
  16. {
  17. hollow-thick setlinewidth
  18. stroke
  19. } bind def
  20. % Normal Finish character; either fill only, stroke and fill
  21. /fin-normal {fin-2} bind def
  22. % Finish character; either fill only, stroke and fill, or hollow
  23. /fin-char {fin-normal} def
  24. /ops [ {curveto}{lineto}{moveto}{closepath}{newpath}{stroke}{eofill}
  25. {gsave}{grestore}{setlinewidth}{setcachedevice} ] bind def
  26. /args [ 6 2 2 0 0 0 0 0 0 1 6 ] bind def
  27. /comp-char
  28. {
  29. newpath
  30. set-char exec
  31. 0 get-byte exec
  32. {
  33. dup 255 eq {fin-char exit} if
  34. mark
  35. exch
  36. dup
  37. args exch get
  38. 5 -2 roll
  39. 3 -1 roll
  40. {get-word} repeat
  41. counttomark 1 add 2 roll
  42. counttomark -1 roll
  43. ops exch get exec
  44. pop
  45. get-byte exec
  46. } loop
  47. 3 {pop} repeat
  48. end
  49. } bind def
  50. /get-byte
  51. {
  52. dup
  53. 1 add
  54. exch
  55. 3 -1 roll
  56. dup
  57. 4 1 roll
  58. exch
  59. get
  60. } bind def
  61. /get-word
  62. {
  63. get-byte exec
  64. 128 sub
  65. 256 mul
  66. 3 1 roll
  67. get-byte exec
  68. 4 -1 roll
  69. add
  70. 3 1 roll
  71. } bind def
  72. /set-char
  73. {
  74. exch
  75. dup dup
  76. /Encoding
  77. get
  78. 4 -1 roll
  79. get
  80. exch
  81. /CharStrings
  82. get
  83. exch
  84. get
  85. exch
  86. begin
  87. } bind def
  88. % POSTSCRIPT PROCEDURE TO DRAW A RULING BOX
  89. % Syntax: "row col width height rule"
  90. /rule {
  91.    /height exch def
  92.    /width exch def
  93.    /col exch def
  94.    /row exch def
  95.    newpath
  96.    /row row -1 mul def
  97.    col row moveto
  98.    0 height rlineto
  99.    width 0 rlineto
  100.    height -1 mul 0 exch rlineto
  101.    width -1 mul 0 rlineto
  102.    fin-normal
  103.    } bind def
  104.  
  105. % Read a string of "count" bytes
  106. % count acquire_string
  107. /acquire_string {
  108.    /count exch def
  109.    count string } def
  110.  
  111. % POSTSCRIPT PROCEDURE TO INITIATE BITMAP GRAPHICS
  112. % width height col row start_raster
  113.  
  114. /start_raster {
  115.    /row exch def
  116.    /col exch def
  117.    /height exch def
  118.    /width exch def
  119.    /neg_height height -1 mul def
  120.    /baseline 0 row sub height sub def
  121.    gsave
  122.    col baseline translate
  123.    width height scale   % Stretch image to correct size
  124. %  Transformation matrix turns image upside down
  125.    width height 1 [ width 0 0 neg_height 0 height ] {
  126.       currentfile { width 4 idiv } acquire_string readhexstring pop
  127.       } bind image
  128.    } def
  129.